<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .head{
            background-color: aqua;
            text-align: center;
            height: 30px;
            width: 100px;
            cursor:pointer;
        }
        .body{
            background-color: pink;
            text-align: center;
            height: 100px;
            width: 100px;
            display: none;
        }
    </style>
    <script>
        function showDiv(divId){
         var divObj=   document.getElementById(divId)
            if (divObj.style.display=="block"){
                divObj.style.display="none";
            }else {
                divObj.style.display="block";
            }
        }

    </script>
</head>
<body>
<div id="mainDiv">
    <div class="head" onclick="showDiv('friendDiv')">好友</div>
    <div class="body" id="friendDiv">
        韦小宝<br>
        陈近南<br>
        张三
    </div>

    <div class="head" onclick="showDiv('twoDiv')">亲人</div>
    <div class="body" id="twoDiv">
        段誉 <br>
        虚竹 <br>
        乔峰
    </div>
    <div class="head" onclick="showDiv('lastDiv')">黑名单</div>
    <div class="body" id="lastDiv">
        海大富<br>
        余不群<br>
        东方不败
    </div>
</div>
</body>
</html>